import React from 'react'
import { Form, Input, InputNumber, message } from 'antd'
import request from '@/utils/request'

export default (props: any) => {
    const { saveForm, id, getList, close } = props
    const onFinish = (values: any) => {
        request(`/store/industry-save/${id}`, {
            method: 'POST',
            data: { ...values },
        }).then((result) => {
            if (result.code !== 200) {
                message.warning(result.message)
                return
            }
            message.success(result.message, 1, () => {
                getList()
                close()
            })
        })
    }
    return (
        <Form
            labelCol={{ span: 5 }}
            wrapperCol={{ span: 17 }}
            form={saveForm}
            onFinish={onFinish}
        >
            <Form.Item label="主营行业名称" name="title" required rules={[{ required: true, message: '主营行业名称不能为空' }]}>
                <Input />
            </Form.Item>
            <Form.Item label="保证金" name="deposit" help="保证金不能小于0，可保留两位小数">
                <InputNumber />
            </Form.Item>
            <Form.Item label="排序" name="sort" help="排序值必须为整数；数值越小，越靠前">
                <InputNumber />
            </Form.Item>
        </Form>
    )
}